#ifndef GAMEWINDOW_H
#define GAMEWINDOW_H

#include <string>
#include "LOpenGL.h"
#include "WindowDebug.h"

class Window
{
public:
	Window(int width, int height, const std::string& title, bool fullscreen, bool debug);
	virtual ~Window();

	void Update();
	void SwapBuffers();

	bool IsClosedRequested() const;
	int GetWidth() const;
	int GetHeight() const;
	float GetAspect() const;
	const std::string& GetTitle() const;
	GLFWwindow* GetGLFWwindow() const;
	void glfw_error_callback(int error, const char* description);
	void glfw_window_size_callback(GLFWwindow* window, int width, int height);
	void log_gl_params();
	void _update_fps_counter(GLFWwindow *window);

private:
	int				m_width;
	int				m_height;
	std::string		m_title;
	bool			m_isFullScreen;
	bool			m_isDebug;
	GLFWwindow*		m_window;
	bool			m_isCloseRequested;
	WindowDebug*    m_windowDebug;
};

/*
///////////////////////////////////////////////////////////////////////////////////////////
//ERROR: I can't define this functions inside Window class because GLFW does not let me
//pass this functions as callbacks :-S
///////////////////////////////////////////////////////////////////////////////////////////

// CALLBACKS
// we will tell GLFW to run this function whenever it finds an error
void glfw_error_callback(int error, const char* description)
{
	m_windowDebug->gl_log_err("GLFW ERROR: code %i msg: %s\n", error, description);
}

// we will tell GLFW to run this function whenever the window is resized
void glfw_window_size_callback(GLFWwindow *window, int width, int height)
{

	m_width = width;
	m_height = height;
	printf("width %i height %i\n", width, height);
	/* update any perspective matrices used here */
//}

#endif